package ezy.widget.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;

import ezy.widget.R;


public final class IconFontView extends TextView {


    public IconFontView(Context context) {
        this(context, null);
    }

    public IconFontView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public IconFontView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.IconFontView);
        String iconFontPath = null;
        try {
            iconFontPath = a.getString(R.styleable.IconFontView_iconFontPath);
        } finally {
            a.recycle();
        }
        try {
            setTypeface(Typeface.createFromAsset(context.getAssets(), iconFontPath));
        } catch (Exception e) {
        }
    }

}